import { $api1 } from '../index';
import { Iresponse } from '../require/type';

// interface Imultidata {
//     banner: any
//     dKeyword: any
//     keywords: any
//     recommend: any
// }
// $api1.request<Imultidata>({
//     url:'/home/multidata',
//     interceptors: {
//         requestSuccessFn: (req) => {
//             console.log('/home/multidata的请求成功拦截');
//             return req
//         },
//         // requestFailureFn: (err) => {
//         //     console.log('/home/multidata的请求失败拦截');
//         //     return err
//         // },
//         responeseSuccessFn: (res) =>{
//             console.log('/home/multidata的响应成功拦截');
//             return res.data
//         },
//         responeseFailureFn: (err) => {
//             console.log('/home/multidata的响应失败拦截');
//             return err
//         }
//     }
// }).then(res => {
//     console.log(res.banner);
// })

export interface IpageData {
  id: string;
  updateTime: string;
  createTime: string;
  // 允许任意字符串属性，值为 any 类型
  [key: string]: any;
}

export interface Ipage {
  code: number;
  data: IpageData[];
  message: any;
  total: number;
}


// 列表
export const ftPage = (data: any) => {
  return $api1.post<Ipage>({
    url: '/front/blogs/page',
    data,
  });
};

// 博客详情
export const ftBlog = (id: string) => {
  return $api1.get<Iresponse>({
    url: '/front/blogs/detail/' + id, 
  });
};

// 分类列表
export const ftTag = () => {
  return $api1.get<Iresponse>({
    url: '/front/tag/select', 
  });
};

// 博客设置信息
export const ftSetting = () => {
  return $api1.get<Iresponse>({
    url: '/front/setting/info', 
  });
};

// 聚焦信息
export const ftFocus = () => {
  return $api1.get<Iresponse>({
    url: '/front/setting/focus', 
  });
};